<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->


<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-cn" xml:lang="zh-cn">
<head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="DC.Type" content="topic">
<meta name="DC.Title" content="步骤4：MySQL/MariaDB数据库开启日志模式">
<meta name="product" content="">
<meta name="DC.Relation" scheme="URI" content="zh-cn_topic_0000001792343590.html">
<meta name="prodname" content="">
<meta name="version" content="">
<meta name="brand" content="30-OceanProtect 备份一体机 1.5.0-1.6.0 帮助中心">
<meta name="DC.Publisher" content="20240320">
<meta name="DC.Format" content="XHTML">
<meta name="DC.Identifier" content="ZH-CN_TOPIC_0000001839142717">
<meta name="DC.Language" content="zh-cn">
<link rel="stylesheet" type="text/css" href="public_sys-resources/commonltr.css">
<title>步骤4：MySQL/MariaDB数据库开启日志模式</title>
</head>
<body style="clear:both; padding-left:10px; padding-top:5px; padding-right:5px; padding-bottom:5px"><a name="ZH-CN_TOPIC_0000001839142717"></a><a name="ZH-CN_TOPIC_0000001839142717"></a>

<h1 class="topictitle1">步骤4：MySQL/MariaDB数据库开启日志模式</h1>
<div><p>MySQL/MariaDB在执行备份任务前，需要开启MySQL/MariaDB数据库日志模式，否则会导致资源接入失败。</p>
<div class="section"><h4 class="sectiontitle">操作步骤</h4><ol><li><span>使用root用户，登录MySQL/MariaDB数据库。</span></li><li><span>执行以下命令查看MySQL/MariaDB数据库是否开启归档模式。</span><p><pre class="screen">show variables like 'log_bin';</pre>
<p>回显如下，“Value”为“ON”，则表示已开启日志模式。</p>
<pre class="screen">+-------------+-----+
|Variable_name|Value|
+-------------+-----+
|   log_bin   |  ON |
+-------------+-----+
1 row in set(0.00 sec)</pre>
</p></li><li><span>执行以下命令查看MySQL/MariaDB数据库的日志模式是否为“ROW”。</span><p><pre class="screen">show variables like 'binlog_format';</pre>
<p>回显如下，“Value”为“ROW”，则表示日志模式为“ROW”。</p>
<pre class="screen">+-------------+-----+
|Variable_name|Value|
+-------------+-----+
|binlog_format| ROW |
+-------------+-----+
1 row in set(0.00 sec)</pre>
</p></li><li><span>如果未开启日志模式或日志模式未设置为“ROW”，请执行该步骤，否则请忽略。</span><p><ol type="a"><li>登录MySQL/MariaDB数据库实例所在主机。</li><li>执行<strong>vi /etc/my.cnf</strong>命令，打开my.cnf配置文件，并在配置文件末尾添加将以下内容。<pre class="screen">log_bin = mysql_bin
binlog_format = ROW
server-id=1</pre>
<div class="note"><img src="public_sys-resources/note_3.0-zh-cn.png"><span class="notetitle"> </span><div class="notebody"><p>在集群场景下，请确保各个节点server-id取值不同。</p>
</div></div>
</li><li>执行重启命令，重启MySQL服务。<p>例如，执行<strong>service mysqld restart</strong>命令，重启MySQL服务。</p>
</li></ol>
</p></li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>父主题：</strong> <a href="zh-cn_topic_0000001792343590.html">备份MySQL/MariaDB数据库</a></div>
</div>
</div>

<div class="hrcopyright"><hr size="2"></div><div class="hwcopyright">版权所有 &copy; 华为技术有限公司</div></body>
</html>